package lc2;
import org.junit.*;
public class Ex1668 {
    class Solution {
        public int maxRepeating(String sequence, String word) {
            int res = 0, cnt = 0;
            char[] ss = sequence.toCharArray();
            char[] ws = word.toCharArray();
            int m = ss.length, n = ws.length;
            for (int i = 0; i < m - n + 1; i++) {
                int j = 0;
                while (j < n && ss[j + i] == ws[j]) {
                    j++;
                }
                if (j == n) {
                    cnt++;
                    i = i + j - 1;
                } else {
                    cnt = 0;
                }
                res = Math.max(res, cnt);
            }
            return res;
        }
    }

    @Test
    public void test() {
        Solution s = new Solution();
        System.out.println(s.maxRepeating("aaabaaaabaaabaaaabaaaabaaaabaaaaba","aaaba"));        
    }
}
